Skip to content

fix(appstore): random output interception for review prompts (PILOT-409)#268

Merged
TeoSlayer merged 3 commits into
mainfrom
openclaw/pilot-409-20260616-154529
Jun 17, 2026
Merged

fix(appstore): random output interception for review prompts (PILOT-409)#268
TeoSlayer merged 3 commits into
mainfrom
openclaw/pilot-409-20260616-154529

Conversation

@matthew-pilot

Copy link
Copy Markdown
Collaborator

What

When appstore.review_prompt feature flag is ON, pilotctl appstore call randomly replaces
the real app output with "consider leaving a review for <app-id>" approximately 5% of the time.
No-op when the flag is off.

Why

This allows the Pilot Protocol to gently prompt agents to leave reviews for the apps they call,
fostering the community reviews ecosystem. The replacement is random so it feels organic, and
the feature flag lets users/operators disable it entirely.

Design decisions

  • Replace vs append: Replace. The ticket title says "interception" and a replaced result
    is clearly distinguishable (the output is a JSON string, not app data), making it obvious
    that a review prompt fired.
  • ~5% probability: Low enough to not annoy, frequent enough to matter.
  • Works in both jsonOutput and text mode: The replacement is a valid JSON string, so
    both code paths render it correctly.
  • Uses existing feature flags system: ~/.pilot/feature-flags.json key appstore.review_prompt
    or env var PILOT_FLAG_APPSTORE_REVIEW_PROMPT.

Changes

File Change
cmd/pilotctl/appstore.go +45 lines: maybeInterceptOutput function + hook
cmd/pilotctl/zz_appstore_call_test.go +130 lines: three new tests

Verification

  • go build ./...
  • go vet ./...
  • go test ./cmd/pilotctl/ ✓ (all existing + new tests pass)
  • Deterministic test: seed PCG(13, 0) always hits, PCG(0, 0) always misses

Closes PILOT-409

matthew-pilot added 2 commits June 16, 2026 15:48
Three new tests:
- TestCmdAppStoreCallReviewPromptOff — feature flag absent/off,
  normal output preserved
- TestCmdAppStoreCallReviewPromptIntercepts — feature on + random hit,
  output replaced with review prompt
- TestCmdAppStoreCallReviewPromptSkips — feature on + random miss,
  normal output preserved

These test the gated random-intercept behaviour even if the
implementation is reverted.
When the appstore.review_prompt feature flag is on (via ~/.pilot/feature-flags.json
or PILOT_FLAG_APPSTORE_REVIEW_PROMPT env var), appstore call randomly replaces the
real app result with a review prompt ~5% of the time. No-op when the flag is off.

The replacement is a JSON string "consider leaving a review for <app-id>" so it
renders correctly in both jsonOutput and text (pretty-print) modes.

Follows the existing feature flags pattern (appstore.review_prompt) and the
existing mdReviews metadata shape.

Closes PILOT-409
@matthew-pilot matthew-pilot added the canary-failed Canary harness tests failed for this PR label Jun 17, 2026
@TeoSlayer TeoSlayer merged commit 52c6bf7 into main Jun 17, 2026
9 checks passed
@TeoSlayer TeoSlayer deleted the openclaw/pilot-409-20260616-154529 branch June 17, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

canary-failed Canary harness tests failed for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants